package com.lzp.systemopt.messenger

import android.os.Bundle
import android.view.View
import com.base.BaseActivity
import com.lzp.systemopt.R
import com.utils.toast.ToastUtils

/**
 * @description:
 * @author: lxp
 * @date: 2022/3/17 下午4:15
 */
class MessengerActivity :BaseActivity(){

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_messenger)

        ToastUtils.toastText("需要其他应用配合使用，暂时无法演示")

        MessengerManager.instance.bindService(this)
        findViewById<View>(R.id.sendMessage).setOnClickListener {
            repeat(10){
                //val random = Math.random()
                val builder = StringBuilder()
                repeat(1000){
                    builder.append("超长消息")
                }
                MessengerManager.instance.sendMessage("$it ===    $builder + end")
            }

        }
    }

    override fun onDestroy() {
        MessengerManager.instance.unbindService(this)
        super.onDestroy()
    }
}